package org.wejob.core.log.util;



import java.time.Duration;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;

public interface Time {
    Time SYSTEM = new SystemTime();

    long milliseconds();

    default long hiResClockMs() {
        return TimeUnit.NANOSECONDS.toMillis(this.nanoseconds());
    }

    long nanoseconds();

    void sleep(long var1);

    void waitObject(Object var1, Supplier<Boolean> var2, long var3) throws InterruptedException;

    default Timer timer(long timeoutMs) {
        return new Timer(this, timeoutMs);
    }

    default Timer timer(Duration timeout) {
        return this.timer(timeout.toMillis());
    }
}
